let klineChart = echarts.init(document.querySelector('#kline2'))
fetch('/api/kline_data')
    .then(resp => resp.json())
    .then(json => {
        let klineOption = {
            title: {
                text: '阿里巴巴2021年K线-teacher'
            },
            xAxis: {
                data: json.data_x
            },
            yAxis: {
                scale: true,
                splitArea: {
                    show: true
                }
            },
            dataZoom: [
                {
                    show: true,
                    type: 'slider',
                    top: '90%',
                    start: 0,
                    end: 100
                }
            ],
            series: [
                {
                    type: 'k',
                    data: json.data_y
                }
            ]
        }
        klineChart.setOption(klineOption)
    })